import 'dart:convert';
import 'dart:io';

import 'package:flutter/foundation.dart';

class ItemDetailUtils {
  static List<Map> loadJsonDataFromFile(String filePath) {
    List<Map> result = [];
    assert(filePath.isNotEmpty, 'file path cannot be null!');
    try {
      final File routeConfig = File(filePath);
      final String s = routeConfig.readAsStringSync();
      result = json.decode(s);
    } catch (e) {
      if (kDebugMode) {
        print('load json data error: $filePath!');
      }
    }
    return result;
  }
}